set mem 550m
set matsize 5000
log using "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\table6.log", replace
#delimit ;
set more 1;
*
* TABLE6.DO
* BY Alex Whalley
* VERSION OF 05/11/11
*
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE TO BE $100k PER PERSON 
*;
gen ECFETd1p = ECFET1d1 / 1000; 
drop ECFET1d1;
rename ECFETd1p ECFET1d1;

gen ECFET2d1p = ECFET1d2 / 1000; 
drop ECFET1d2;
rename ECFET2d1p ECFET2d1;

gen ECFET3d1p = ECFET1d3 / 1000; 
drop ECFET1d3 ECFET3d1;
rename ECFET3d1p ECFET3d1;

gen ECFET4d1p = ECFET1d4 / 1000; 
drop ECFET1d4;
rename ECFET4d1p ECFET4d1;

gen ECFET5d1p = ECFET1d5 / 1000; 
drop ECFET1d5 ECFET5d1;
rename ECFET5d1p ECFET5d1;


*gen ECFETd2p = ECFETd2 / 1000; 
*drop ECFETd2;
*rename ECFETd2p ECFETd2;
*gen ECFETd3p = ECFETd3 / 1000; 
*drop ECFETd3;
*rename ECFETd3p ECFETd3;
*gen ECFETd4p = ECFETd4 / 1000; 
*drop ECFETd4;
*rename ECFETd4p ECFETd4;
*gen ECFETd5p = ECFETd5 / 1000; 
*drop ECFETd5;
*rename ECFETd5p ECFETd5;
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*;
*
* OLS YEAR BY YEAR PARSE OUT
*;
xi: reg lincome3d1 ECFET1d1 ECFET2d1 ECFET3d1 i.year [fw=semp81] if endowl4_spindexd3d1 !=., cluster(FIPSCOUNTY);
sum lincome3d1 if endowl4_spindexd3d1 !=.;
xi: reg lincome5d1 ECFET1d1 ECFET2d1 ECFET3d1 ECFET4d1 ECFET5d1 i.year [fw=semp81] if endowl6_spindexd5d1 !=., cluster(FIPSCOUNTY);
sum lincome5d1 if endowl6_spindexd5d1 !=.;
*
* CLOSE LOG, CLEAR AND END
*;
log close;
*clear;